
library(lcmm)
library(tidyr)

# LCMM
setwd("D:/projects/Vision")

df <- readxl::read_xlsx("./Data/lcmm.xlsx")
dft <- pivot_longer(
  df,
  c(vis1,vis2,vis3,vis4,vis4,vis5,vis6),
  names_to = "visit",
  values_to = "SE",
  values_drop_na=T
)
dft$time <- as.numeric(stringr::str_extract_all(dft$visit,"\\d"))

# load
load("./Temp/class1.Rdata")
load("./Temp/class2.Rdata")
load("./Temp/class3.Rdata")
load("./Temp/class4.Rdata")
load("./Temp/class5.Rdata")
#load("./Temp/class6.Rdata")

summarytable(fit1,fit2,fit3,fit4,fit5, 
             which = c("G", "loglik", "conv", "npm", "AIC", "BIC", "SABIC", 
                       "entropy","ICL", "%class"))
summaryplot(fit1,fit2,fit3,fit4,fit5, which = c("loglik","AIC", "BIC", "SABIC", 
                                                "entropy"))
plot(fit4)
